# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=libvolk
pkgver=2.5.0
_cpufeaturesver=0.6.0
pkgrel=3
pkgdesc="Vector-Optimized Library of Kernels"
url="https://www.libvolk.org/"
# libvolk provides hand-written SIMD code. Hence, support needs to be manually
# added to new platforms. Currently only supported are:
arch="armv7 aarch64 x86_64"
license="GPL-3.0-or-later"
depends="python3"
makedepends="cmake py3-mako boost-dev orc-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/gnuradio/volk/archive/v$pkgver.tar.gz
	cpu_features-$_cpufeaturesver.tar.gz::https://github.com/google/cpu_features/archive/v$_cpufeaturesver.tar.gz
	"
builddir="$srcdir/volk-$pkgver"

prepare() {
	default_prepare

	rm -r cpu_features
	ln -s "../cpu_features-$_cpufeaturesver" cpu_features
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

check() {
	cmake --build build --target test
}

sha512sums="
60b9d3aae57a3c0b40d5d5830f585b141245eb61e3d9991576f2bd8daad93bbe9938c963427e150edaff8f93b5e3d851a5736950d6573a955c4516255f43c00d  libvolk-2.5.0.tar.gz
006a2e05253712cf605ecabccdda63dd9325445f8d145d5e2432c4342332e652f318810997321849be131082db435d88143020fdc85268fba204586cf37eef0d  cpu_features-0.6.0.tar.gz
"
